<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="../eshop/css/style.css">
    <title>聊天室程序</title>
</head>
<body>
<div id="feeBack">

</div>
<button  id="sendBtn">发送信息</button>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script src="../../lib/web/websocket/Webscoket.reconnect.js"></script>
<script src="../../lib/web/websocket/TioUtils.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        var config ={
            "url":"ws://192.168.0.108:8084/cms",
            "onOpenEvent":function(ws){
                console.log("连接上了服务器了:"+ws);
            },
            "onMessageEvent":function(ws,resp){
                console.log("接受到了信息了:"+resp)
                $("#feeBack").after("<p>"+resp+"</p>")
            },
            "onSendMsgEvent":function(ws){
                ws.send("我是测试信息");
            }
        }
        var tio = new TioUtils(config);
        $("#sendBtn").click(function () {
            tio.sendMsg();
        })
    })
</script>
</body>
</html>